#include "ControllerBase.h"
#include "Application.h"

void cat::ControllerBase::think()
{
	sf::RenderWindow& window = cat::Application::current().getWindow();
	sf::Event event;
    while (window.pollEvent(event))
    {
		if (event.type == sf::Event::Closed)
		{
			window.close();
		}
		else
		{
			std::list<ControllerBase*>::iterator it = cat::Application::current().getControllersIteratorBegin();
			std::list<ControllerBase*>::iterator end = cat::Application::current().getControllersIteratorEnd();
			for(;it != end; ++it)
			{
				(*it)->treatEvent(event);
			}
		}
	}
}